package com.yzs.base.view

import android.content.Context
import android.text.TextUtils
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView

/**
 *    author : yzs
 *    date   : 2022/1/139:32
 *    desc   : 跑马灯
 *    https://www.cnblogs.com/dasusu/p/6593991.html
 */
class MarqueTextView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : AppCompatTextView(context, attrs, defStyleAttr) {
    init {
        initMarque()
    }

    private fun initMarque() {
        setSingleLine()
        ellipsize = TextUtils.TruncateAt.MARQUEE
        marqueeRepeatLimit = -1
    }


    override fun isFocused(): Boolean {
        //就是把这里返回true即可
        return true
    }

}